﻿@{

    Layout = null;
}

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>广州中医药大学康复治疗微课程网络学习平台登陆</title>
    @Html.Partial("~/Views/Share/PublicHeader.cshtml")
    <style type="text/css">
        .clearfix:after {
            display: block;
            height: 0;
            visibility: hidden;
            content: "";
            clear: both;
        }

        html, body {
            width: 100%;
            height: 100%;
        }

        body {
            background: url("../Images/login.jpg") scroll no-repeat center center transparent;
            position: relative;
        }

        .login {
            position: absolute;
            width: 340px;
            height: 200px;
            top: 50%;
            left: 50%;
            margin-top: -100px;
            margin-left: -170px;
        }

            .login form p:after {
                display: block;
                height: 0;
                visibility: hidden;
                content: "";
                clear: both;
            }

            .login form p {
                margin-bottom: 26px;
            }

                .login form p.error {
                    margin-bottom: 5px;
                    padding-left: 70px;
                    height: 16px;
                    line-height: 16px;
                    color: red;
                }

                .login form p.special {
                    margin-bottom: 0;
                }

                    .login form p.special a {
                        float: left;
                        width: 80px;
                        margin-left: 9px;
                        text-decoration: none;
                    }

                .login form p.last {
                    padding-left: 70px;
                }

                .login form p label, .login form p input {
                    float: left;
                }

                .login form p label {
                    font-family: 'microsoft yahei';
                    width: 70px;
                    font-size: 16px;
                    height: 27px;
                    line-height: 27px;
                    font-weight: normal;
                }

                .login form p input[type=text], .login form p input[type=password] {
                    width: 265px;
                    height: 27px;
                    border: 1px solid #7d7d7d;
                    border-radius: 2px;
                    padding: 0;
                }

                    .login form p input[type=text].special {
                        width: 175px;
                    }

                .login form p input[type=button] {
                    width: 61px;
                    height: 34px;
                    background: url("../Images/loginBtn.jpg") scroll no-repeat center center transparent;
                    border: none;
                    padding: 0;
                    cursor: pointer;
                }
        /*modal custom style*/
        .custom .modal-header {
            padding: 9px;
        }

        .custom .modal-body {
            padding: 8px 8px 0;
        }

        .custom .modal-footer {
            padding: 5px;
        }

        .custom .modal-dialog {
            width: 400px;
        }
    </style>
</head>
<body>

    <div class="login">
        <form>
            <p><label>用户名：</label><input type="text" value="" id="uName" name='uName' /></p>
            <p><label>密&nbsp;&nbsp;码：</label><input type="password" value="" id="pwd" name='pwd' /></p>
            <p class="special">
                <label>验证码：</label>
                <input type="text" value="" id="yzm" name='yzm' class="special" />
                <a href="javascript:void(0)" title="点击刷新"><img id="yzimg" src="/Account/GetVerifyCode" height="29" /></a>
            </p>
            <p class="error" id="error"></p>
            <p class="last"><input type="button" value="" id="loginBtn" name="loginBtn" /></p>
        </form>
    </div>
    <script src="~/Content/jquery1.11.1.min.js"></script>
    <script src="~/Content/bootstrap/js/bootstrap.min.js"></script>
    <script src="~/Js/common.js"></script>
    <script>
        $(function () {
            var $uName = $("#uName"), $pwd = $("#pwd"), $yzm = $("#yzm");
            $("#yzimg").click(function () {
                var src = "@Url.Action("GetVerifyCode", "Account")?" + Date();
                $("#yzimg").attr("src", src);
            });
            $("#loginBtn").click(function () {
                var _uName = $uName.val().trim(), _pwd = $pwd.val().trim(), _yzm = $yzm.val().trim();
                if (_uName == "") { tip("用户名不能为空！"); return; }
                if (_pwd == "") { tip("密码不能为空！"); return; }
                if (_yzm == "") { tip("验证码不能为空！"); return; }
                else tip("");
                $.easyPost("@Url.Action("AjaxLogOn", "Account")", { "UserName": _uName, "PassWord": _pwd, "VerifyCode": _yzm },function (data) {
                            if (!data.result) {
                                tip(data.message);
                                var src = "@Url.Action("GetVerifyCode", "Account")?" + Date();
                                $("#yzimg").attr("src", src);
                            } else {
                                //学生、教师、管理员
                                tip("");
                                var href;
                                $.cookie("username", data.entity.UserName, { path: "/", expiress: 7 });
                                $.cookie("role", data.entity.RoleCode, { path: "/", expiress: 7 });
                                //跳转至用户中心
                                roleCheck(data.entity.RoleCode,1);
                            }
                        }, "json");
            });
            //点击Enter键，提交登陆表单
            $(window).bind("keydown", function (event) {
                if (event.keyCode == 13) $("#loginBtn").trigger("click");
            });
        });
        function tip(str) {
            $("#error").text(str);
        }
    </script>

</body>
</html>